package com.BlogPark.service.EditPersonalInformationService.Impl;

import com.BlogPark.config.SpringConfig;
import com.BlogPark.mapper.DetailsUserMapper;
import com.BlogPark.pojo.DetailsUser;
import com.BlogPark.service.EditPersonalInformationService.EditPersonalInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.test.context.ContextConfiguration;

/**
 * @Auther: MFM
 * @Date: 2022/8/10 - 08 - 10 - 21:24
 * @version: 1.0
 */

@Service
@ContextConfiguration(classes = SpringConfig.class)
public class EditPersonalInformationServiceImpl implements EditPersonalInformationService {

    @Autowired
    private DetailsUserMapper detailsUserMapper;

    /**
     * @param id
     * @return
     * 功能：查看用户详细信息
     */
    @Override
    public DetailsUser ViewPersonalInfo(int id) {

        //1.查询用户详细信息
        DetailsUser user = detailsUserMapper.selectById(id);
        return user;
    }

    /**
     *
     * @param user
     * @return  受影响的行数
     */
    @Override
    public Integer EditPersonalInfo(DetailsUser user) {
        Integer data = detailsUserMapper.updateDetailsUserInfo(user);
        return data;
    }

    @Override
    public String getprofilePhoto(Integer userId) {
        String s = detailsUserMapper.getprofilePhoto(userId);
        return s;
    }
}
